//需要拦截器的地方使用instance对象， 有自定义返回逻辑的地方沿用axios，在组件内部处理返回结果即可
import request from '/@/utils/request';

export default function () {
    /**
     * 渠道产品客户服务记录分页查询.
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const queryCustomerServiceRecord = (params: object) => {
        return request({
            url: "/SysApi/Channel/CustomerServiceRecord/QueryPage",
            method: "post",
            data: params,
        });
    };

    /**
     * 信息流信息回传分页查询
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const queryProductRecord = (params: object) => {
        return request({
            url: "/SysApi/Channel/ProductRecord/QueryPage",
            method: "post",
            data: params,
        });
    };

    /**
     * 信息流信息回传信息通过ID查询
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const queryByIdProductRecord = (params: object) => {
        return request({
            url: "/SysApi/Channel/ProductRecord/QueryById",
            method: "post",
            data: params,
        });
    };

    /**
     * 信息流信息回传登记
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const registerCustomerServiceRecord = (params: object) => {
        return request({
            url: "/SysApi/Channel/CustomerServiceRecord/Register",
            method: "post",
            data: params,
        });
    };

    /**
     * 渠道产品客户服务记录编辑
     * @param params 要传的参数值
     * @returns 返回接口数据
     */
    const editCustomerServiceRecord = (params: object) => {
        return request({
            url: "/SysApi/Channel/CustomerServiceRecord/edit",
            method: "post",
            data: params,
        });
    };

    /**
     * 渠道产品客户服务记录编辑
     * @param params 要传的参数值
     * @returns 返回接口数据
    */
    const queryTelecomUserPackageInfo = (params: object) => {
        return request({
            url: "https://ch.qimingwenhua.net/ChannelApi/Telecom/VRBT/GetUserPackageInfoAll",
            method: "get",
            params,
        });
    };

    /**
     * 渠道产品客户服务记录编辑
     * @param params 要传的参数值
     * @returns 返回接口数据
    */
    const unsubscribeMonthly = (params: object) => {
        return request({
            url: "https://ch.qimingwenhua.net/ChannelApi/Telecom/VRBT/UnsubscribeMonthly",
            method: "get",
            params,
        });
    };


    /**
     * 客服记录查询接口
     * @param params 要传的参数值
     * @returns 返回接口数据
    */
    const RecordQueryPage = (params: object) => {
        return request({
            url: "/SysApi/Channel/CustomerServiceRecord/RecordQueryPage",
            method: "post",
            data:params
        });
    };

     /**
     * 客服记录导出接口
     * @param params 要传的参数值
     * @returns 返回接口数据
    */
     const ExportExcel = (params: object) => {
        return request({
            url: "/SysApi/Channel/CustomerServiceRecord/ExportExcel",
            method: "post",
            headers: { 'Content-Type': 'application/json-patch+json' },
            data: params,
            responseType: 'blob'
        });
    };


    return {
        queryCustomerServiceRecord,
        queryProductRecord,
        registerCustomerServiceRecord,
        queryByIdProductRecord,
        editCustomerServiceRecord,
        queryTelecomUserPackageInfo,
        unsubscribeMonthly,
        RecordQueryPage,
        ExportExcel
    };
}
